<?php
/*
 *      navigator.php
 *
 *      Copyright 2010 vetal <vetal@vetal>
 *
 *      This program is free software; you can redistribute it and/or modify
 *      it under the terms of the GNU General Public License as published by
 *      the Free Software Foundation; either version 2 of the License, or
 *      (at your option) any later version.
 *
 *      This program is distributed in the hope that it will be useful,
 *      but WITHOUT ANY WARRANTY; without even the implied warranty of
 *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *      GNU General Public License for more details.
 *
 *      You should have received a copy of the GNU General Public License
 *      along with this program; if not, write to the Free Software
 *      Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 *      MA 02110-1301, USA.
 */

require_once("./classes/GUI/nwmsg.php");
require_once("./classes/system.php");

require_once("./config.php");
//session_start();
require_once("./classes/System/osmetadata.php");
//$a = 3;

class navig {


	private $uuid;

	function __construct() {
		$this->uuid = genUUID();
		$_SESSION[$this->uuid] = &$this;
	}

	function show() {
		$out = "<div align=left><table>";
		$out .= "<tr><td><input type='button' name='ЕдиницыИзмерения' value='Единицы измерения' onclick=message('$this->uuid','onclick',this.name,'');></td></tr>";
		$out .= "<tr><td><input type='button' name='Сотрудники' value='Сотрудники' onclick=message('$this->uuid','onclick',this.name,'');></td></tr>";
		$out .= "<tr><td><input type='button' name='Пол' value='Пол' onclick=message('$this->uuid','onclick',this.name,'');></td></tr>";
		//$out .= "<tr><td><input type='button' name='same_other' value='Че нить другое' onclick=message('$this->uuid','onclick','same_other','');></td></tr>";
		//$out .= "<tr><td><input type='button' name='Пол_new_method' value='Пол new method' onclick=message('$this->uuid','onclick','Пол_new_method','');></td></tr>";
		$out .= "</table></div>";
		return $out;
	}

	function onclick($param1 = null, $param2 = null) {
		//require_once("./classes/System/nwmetadata.php");
		$a = 3;
		switch ($param1) {
			case "ЕдиницыИзмерения":{ 
				//$_SESSION[UUID_NWVIEVER]->change("./model/dictionaries/edinici_izmerenija.php"); 
				$GLOBALS["metadata"]->objects->ЕдиницыИзмерения->listform->show();
				break;
			}
			case "Сотрудники":{ 
				//$_SESSION[UUID_NWVIEVER]->change("./model/dictionaries/сотрудники.php"); 
				$GLOBALS["metadata"]->objects->Сотрудники->listform->show();
				break;
			}
			case "Пол":{ 
				//$_SESSION[UUID_NWVIEVER]->change("./model/dictionaries/пол.php"); 
				$GLOBALS["metadata"]->objects->Пол->listform->show();
				break;
			}
			case "same_other":{ 
				//$_SESSION[UUID_NWVIEVER]->change("./model/dictionaries/same_other.php"); 
				break;
			}
			case "Пол_new_method":{ 
				//$_SESSION[UUID_NWVIEVER]->change("./model/dictionaries/same_other.php"); 
				
				$GLOBALS["metadata"]->objects->Пол->defaultlistform->show();
				//$a = var_export($GLOBALS, true);
				//new \GUI\nwmsg($a);
				//$metadata
				//print_r($_GLOBALS);
				//$b = $a;
				break;
			}
		}
	}
}
?>
